/**
 * 视频生成控制器
 * @module controllers/videoController
 */

const videoGenerator = require('../services/textAndImageToVideo');
const videoGenerator2 = require('../services/textAndImgAndAudioToVideo');
const logger = require('../utils/logger');



// 文本图片音频生成视频
const textAndImgAndAudioToVideo = async (req, res) => {
  logger.logRequest(req);
  try {
    const result = await videoGenerator2.textAndImgAndAudioToVideo(req.body);
    res.status(200).json(result);
  } catch (error) {
    logger.logError(error);
    res.status(500).json({ error: error.message });
  }
};





/**
 * 文本和图片生成视频
 * @async
 * @function generateVideo
 * @param {Object} req - Express 请求对象
 * @param {Object} res - Express 响应对象
 * @returns {Promise<void>}
 */
const textAndImageToVideo = async (req, res) => {
  logger.logRequest(req);
  try {
    const result = await videoGenerator.textAndImageToVideo(req.body);
    res.status(200).json(result);
  } catch (error) {
    logger.logError(error);
    res.status(500).json({ error: error.message });
  }
};


// 导出
module.exports = {
  textAndImageToVideo,
  textAndImgAndAudioToVideo
}; 